#pragma once
#include"M_S_Hash.h"

template <class K,class V>
class unordered_map{
public:
	struct MapKeyOfT{	
		const K& operator()(const pair<K,V>& kv)
		{
			return kv.first;
		}
	};

public:
	typedef typename cxy::OpHash<K, pair<K, V>, MapKeyOfT>::iterator iterator;

	iterator begin()
	{
		return _ht.begin();
	}

	iterator end()
	{
		return _ht.end();
	}

	pair<iterator, bool> Insert(const pair<K,V>& kv)
	{
		return _ht.Insert(kv);
	}

	V& operator[](const K& key)
	{
		pair<iterator, bool> ret = _ht.Insert(make_pair(key, V()));
		return ret.first->second;
	}

private:
	cxy::OpHash<K, pair<K, V>, MapKeyOfT> _ht;
};